﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cosmetic.DataEntity;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.Collections;
using System.Net.Mail;
using Cosmetic.Logic;

namespace WebApp
{
    public class tools : PageBase
    {
        private static string mailServer = ConfigurationManager.AppSettings["SmtpServer"];
        private static string mailUserName = ConfigurationManager.AppSettings["SmtpUserName"];
        private static string mailPassword = ConfigurationManager.AppSettings["SmtpPassWord"];
        private static string BaseDomain = ConfigurationManager.AppSettings["BaseDomain"];
        private static UserManager m_UserManager = new UserManager();
        public static void SendEmail(MailMessage mm)
        {
            SmtpClient theSmtp = new SmtpClient();
            theSmtp.Host = mailServer;
            theSmtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            theSmtp.Port = 25;
            theSmtp.UseDefaultCredentials = false;
            theSmtp.Credentials = new System.Net.NetworkCredential(mailUserName, mailPassword);
            mm.From = new MailAddress(mailUserName);

            theSmtp.Send(mm);
        }


        public User CreateOrder()
        {

            User users = m_UserManager.GetUserById(SignInUser.UserId );
            users.tel = SignInUser.tel;
            users.Password = SignInUser.Password;
            users.Email = SignInUser.Email;
            return users;
        }
    }
}
